package com.shtel.bss.saas.core.biz.common.vo;


import java.io.Serializable;

/**
 * @program: 测试
 * @description:返回的JSON数据结构标准
 * @author: mtb
 * @create: 2018-10-17 09:01
 **/
public class RetResult<T>   implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * SpringBoot 的错误返回
     * {
     *     "timestamp": 1581585638696,
     *     "status": 404,
     *     "error": "Not Found",
     *     "message": "No message available",
     *     "path": "/"
     * }
     */

    private T data;

    private int code;

    private String msg;

    private String error;

    private String path;

    public RetResult() {
    }

    public RetResult(int code, String error, String msg, String path) {
        this.code = code;
        this.msg = msg;
        this.error = error;
        this.path = path;
    }

    public RetResult(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public RetResult<T> setCode(RetCode retCode) {
        this.code = retCode.code;
        return this;
    }

    public RetResult(T data, int code, String msg, String error, String path) {
        this.data = data;
        this.code = code;
        this.msg = msg;
        this.error = error;
        this.path = path;
    }

    public RetResult(T data, int code, String msg, String error) {
        this.data = data;
        this.code = code;
        this.msg = msg;
        this.error = error;
    }

    public RetResult(int code, String msg, String path) {
        this.code = code;
        this.msg = msg;
        this.path = path;
    }

    public int getCode() {
        return code;
    }

    public RetResult<T> setCode(int code) {
        this.code = code;
        return this;
    }

    public String getMsg() {
        return msg;
    }

    public RetResult<T> setMsg(String msg) {
        this.msg = msg;
        return this;
    }

    public T getData() {
        return data;
    }

    public RetResult<T> setData(T data) {
        this.data = data;
        return this;
    }

    public String getError() {
        return error;
    }

    public void setError(String error) {
        this.error = error;
    }

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }
}
